From 05e4a93f5b6f4aa0aaa652c8ab935b4929ac8008 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Sun, 20 Nov 2005 21:24:43 +0000 Subject: [PATCH] Bugfix for embedded translations. --- win32/gui-2/gnugettext.pas | 86 ++++++-------------------------------- 1 file changed, 12 insertions(+), 74 deletions(-) diff --git a/win32/gui-2/gnugettext.pas b/win32/gui-2/gnugettext.pas index 2ca05de3c..b05e70ff7 100644 --- a/win32/gui-2/gnugettext.pas +++ b/win32/gui-2/gnugettext.pas @@ -3,8 +3,8 @@ unit gnugettext; (* *) (* (C) Copyright by Lars B. Dybdahl and others *) (* E-mail: Lars@dybdahl.dk, phone +45 70201241 *) -(* File version: $Date: 2005/09/28 00:33:08 $ *) -(* Revision: $Revision: 1.1 $ *) +(* File version: $Date: 2005/11/20 21:24:43 $ *) +(* Revision: $Revision: 1.2 $ *) (* *) (* Contributors: Peter Thornqvist, Troy Wolbrink, *) (* Frank Andreas de Groot, Igor Siticov, *) @@ -49,6 +49,7 @@ interface {$endif} {$ifdef VER120} // Delphi 4 + {$DEFINE DELPHI4OROLDER} {$DEFINE DELPHI5OROLDER} {$DEFINE DELPHI6OROLDER} {$endif} @@ -84,8 +85,13 @@ interface {$endif} uses -{$ifdef DELPHI5OROLDER} - gnugettextD4, + TypInfo, +{$ifdef DELPHI4OROLDER} + gnugettextD4, +{$else} + {$ifdef DELPHI5OROLDER} + gnugettextD5, + {$endif} {$endif} {$ifdef MSWINDOWS} @@ -93,7 +99,7 @@ uses {$else} Libc, {$endif} - Classes, SysUtils, TypInfo; + Classes, SysUtils; (*****************************************************************************) (* *) @@ -346,14 +352,6 @@ type var DefaultInstance:TGnuGettextInstance; -// DELPHI 4 - -function GetStrProp(Instance: TObject; const Name: string): string; overload; -function GetStrProp(Instance: TObject; Info: PPropInfo): string; overload; - -procedure SetStrProp(Instance: TObject; const Name, Value: string); overload; -procedure SetStrProp(Instance: TObject; Info: PPropInfo; const Value: string); overload; - implementation (**************************************************************************) @@ -2379,7 +2377,7 @@ begin // Find TMoFile object MoFilesCS.BeginWrite; try - idxname:=realfilename+#0+IntToStr(offset); + idxname:=realfilename+#1+IntToStr(offset); if MoFiles.Find(idxname, idx) then begin Result:=MoFiles.Objects[idx] as TMoFile; end else begin @@ -2794,66 +2792,6 @@ begin end; end; -// DELPHI4 - -function GetPropInfo(Instance: TObject; const Name: string; var PropInfo: TPropInfo): Boolean; -var - Props: PPropList; - TypeData: PTypeData; - Info: PPropInfo; - i: Integer; -begin - TypeData := GetTypeData(Instance.ClassInfo); - if ((TypeData <> nil) and (TypeData^.PropCount > 0)) then - begin - GetMem(Props, TypeData^.PropCount * sizeof(Pointer)); - try - GetPropInfos(Instance.ClassInfo, Props); - for i := 0 to TypeData.PropCount - 1 do - begin - Info := Props[i]; - if (AnsiCompareText(Info.Name, Name) = 0) then - begin - PropInfo := Info^; - Result := True; - Exit; - end - end; - finally - FreeMem(Props); - end; - end; - Result := False; -end; - -function GetStrProp(Instance: TObject; Info: PPropInfo): string; -begin - Result := TypInfo.GetStrProp(Instance, Info); -end; - -function GetStrProp(Instance: TObject; const Name: string): string; -var - Info: TPropInfo; -begin - if GetPropInfo(Instance, Name, Info) then - Result := TypInfo.GetStrProp(Instance, @Info) - else - Result := ''; -end; - -procedure SetStrProp(Instance: TObject; const Name, Value: string); -var - Info: TPropInfo; -begin - if GetPropInfo(Instance, Name, Info) then - SetStrProp(Instance, @Info, Value); -end; - -procedure SetStrProp(Instance: TObject; Info: PPropInfo; const Value: string); -begin - TypInfo.SetStrProp(Instance, Info, Value); -end; - initialization {$ifdef DXGETTEXTDEBUG} {$ifdef MSWINDOWS} -- 2.30.2